| Conditions | 1 |
| Total Lines | 63 |
| Code Lines | 58 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React from 'react'; |
||
| 105 | |||
| 106 | render() { |
||
| 107 | return ( |
||
| 108 | <div className="register_container"> |
||
| 109 | <form className="form_register" method="post" onSubmit={this.handleSubmit}> |
||
| 110 | <label className="input_label"> |
||
| 111 | Name |
||
| 112 | <input |
||
| 113 | required |
||
| 114 | name="fullname" |
||
| 115 | type="text" |
||
| 116 | onChange={this.changeHandler} |
||
| 117 | /> |
||
| 118 | </label> |
||
| 119 | |||
| 120 | <label className="input_label"> |
||
| 121 | |||
| 122 | <input |
||
| 123 | required |
||
| 124 | name="email" |
||
| 125 | type="email" |
||
| 126 | onChange={this.changeHandler} |
||
| 127 | /> |
||
| 128 | </label> |
||
| 129 | |||
| 130 | <label className="input_label"> |
||
| 131 | Password |
||
| 132 | <input |
||
| 133 | required |
||
| 134 | name="password" |
||
| 135 | type="password" |
||
| 136 | onChange={this.changeHandler} |
||
| 137 | /> |
||
| 138 | </label> |
||
| 139 | |||
| 140 | <div className="date_picker_container"> |
||
| 141 | |||
| 142 | <label className="input_label"> |
||
| 143 | <span>Birthdate </span><span className="small_description_text">e.g. 1900-01-01 (Y-M-D)</span> |
||
| 144 | <input |
||
| 145 | required |
||
| 146 | type="year" |
||
| 147 | name="birthdate" |
||
| 148 | value={this.state.birthdate} |
||
| 149 | onChange={this.validateBirthdate} |
||
| 150 | maxLength="10" |
||
| 151 | /> |
||
| 152 | <p className="error_message">{this.state.errorMessage} </p> |
||
| 153 | </label> |
||
| 154 | </div> |
||
| 155 | <div className="terms_and_conditions_text"> |
||
| 156 | <label> |
||
| 157 | I accept <a href="/register" onClick={openTermAndConditions} className="form_link"> Terms |
||
| 158 | and Conditions</a> |
||
| 159 | </label> |
||
| 160 | <input name="gdpr" required type="checkbox"/> |
||
| 161 | </div> |
||
| 162 | |||
| 163 | |||
| 164 | <input name="register" type="Submit" defaultValue="Register" className="button_submit"/> |
||
| 165 | |||
| 166 | </form> |
||
| 167 | </div> |
||
| 168 | ) |
||
| 212 | export default Register; |